home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #1 / Ham Radio 2000.iso / ham2000 / packet / p_aa4re / mbb35src / mbbtimer.asm < prev    next >
Encoding:
Assembly Source File  |  1987-04-28  |  3.4 KB  |  90 lines

  1. ;==========================================================================;
  2. ; Timer interrupt handler                                                  ;
  3. ;                                                                          ;
  4. ;   Copyright 1983 by William E. Westfield.  All rights reserved.          ;
  5. ;   Copyright 1986, 1987 by H. Roy Engehausen.  All rights reserved.       ;
  6. ;   This software may be freely distributed and used, but it may not       ;
  7. ;   under any circumstances be sold by anyone other than the author.       ;
  8. ;   It may be distributed by a commercial company as long as it is         ;
  9. ;   for no cost.                                                           ;
  10. ;                                                                          ;
  11. ;   Permission is explicity granted to use this code as a model for        ;
  12. ;   other programs requiring interupt driven serial I/O as long as they    ;
  13. ;   carry this copyright notice.                                           ;
  14. ;==========================================================================;
  15.  
  16. timer_int:
  17.  
  18.         PUSH    SI                  ; Save SI so we can put things in it
  19.         PUSH    AX                  ;
  20.         PUSH    BX                  ;
  21.         PUSH    CX                  ;
  22.         PUSH    DX                  ;
  23.         PUSH    DS                  ;
  24.         PUSH    ES                  ;
  25.  
  26.         MOV     AX,CS               ; Use DS as needed
  27.         MOV     DS,AX               ;
  28.       ASSUME DS: everything         ; We now have DS working
  29.  
  30.         MOV     AL,timer_counter    ; Increment timer counter
  31.         CBW                         ;
  32.         INC     AX                  ;
  33.         MOV     timer_counter,AL    ;
  34.  
  35.         MOV     SI,OFFSET com_start ; Start of COM Blocks
  36.  
  37. timer_loop:
  38.  
  39.         MOV     BL,chip[SI]         ; Get chip number
  40.         SHL     BL,1                ; *2 for words
  41.         SUB     BH,BH               ; Need a zero too
  42.         JMP     timer_jmp[BX]       ; Jump to handler
  43.  
  44. timer_jmp LABEL WORD
  45.         DW      OFFSET timer_next   ;      Slot not used
  46.         DW      OFFSET timer_8250   ;      8250 - IBM ASYNC board
  47.         DW      OFFSET timer_8251   ;      8251 - IBM BSC board in ASYNC mode
  48.         DW      OFFSET timer_8530   ;      8530 - PACCOMM PC-100 board
  49.         DW      OFFSET timer_8250   ;      QUADRAM QuadPort
  50.         DW      OFFSET timer_8250   ;      4 async port card
  51.  
  52. timer_8250:
  53.  
  54.  IF present_8250
  55.    INCLUDE 8250TMR.ASM
  56.  ENDIF
  57.  
  58.         JMP     timer_next
  59.  
  60. timer_8251:
  61.         JMP     timer_next
  62.  
  63. timer_8530:
  64.  
  65.  IF present_8530
  66.    INCLUDE 8530TMR.ASM
  67.  ENDIF
  68.  
  69. ;       JMP     timer_next          ; We can just fall thru
  70.  
  71. timer_next:
  72.  
  73.         MOV     SI,CS:com_next[SI]  ; Get next com block
  74.         OR      SI,SI               ; If still no more blocks then
  75.         JZ      timer_exit          ;      leave
  76.         JMP     timer_loop          ; Loop back for next
  77.  
  78. timer_exit:                         ;
  79.  
  80.       ASSUME DS: NOTHING            ; DS now invalid
  81.  
  82.         POP     ES                  ; Restore registers
  83.         POP     DS                  ;
  84.         POP     DX                  ;
  85.         POP     CX                  ;
  86.         POP     BX                  ;
  87.         POP     AX                  ;
  88.         POP     SI                  ;
  89.         JMP     CS:DWORD PTR timer_old ; Call old timer interrupt
  90.